Welcome![Sign In][Sign Up]
Location:
Search - select socket fd

Search list

[Internet-NetworkSelect()系统调用及 文件描述符集fd_set的应用

Description: Select()系统调用及 文件描述符集fd_set的应用.rar-Select () system call and file descriptors set fd_set applications. Rar
Platform: | Size: 1024 | Author: 魏秦 | Hits:

[Linux-UnixIO-(2)

Description: *使用select函数可以以非阻塞的方式和多个socket通信。程序只是演示select函数的使用,即使某个连接关闭以后也不会修改当前连接数,连接数达到最大值后会终止程序。 1. 程序使用了一个数组fd,通信开始后把需要通信的多个socket描述符都放入此数组 2. 首先生成一个叫sock_fd的socket描述符,用于监听端口。 3. 将sock_fd和数组fd中不为0的描述符放入select将检查的集合fdsr。 4. 处理fdsr中可以接收数据的连接。如果是sock_fd,表明有新连接加入,将新加入连接的socket描述符放置到fd。 */ // select_server.c-* use Select function with non blocking mode and multiple socket communication. The program is the use of demonstration of select function, even if a connection is closed will not modify the current number of connections, the number of connections after reaching the maximum value will terminate the program. 1 procedures for the use of an array of FD, communication after the start of the multiple socket descriptor communication in this array 2 first generate a call sock_fd socket descriptor, for listening port. 3 the sock_fd and array FD is not 0 descriptors in select will check the set fdsr. 4 fdsr can be connected to receive data. If sock_fd, indicates that there is a new connection to join, will join the new connection socket descriptor is placed into the fd.* //select_server.c
Platform: | Size: 3072 | Author: 辰枫 | Hits:

CodeBus www.codebus.net